package org.lbspoc.springboot1.boot.validation;

import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import static java.lang.annotation.ElementType.FIELD;

import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;

@Target({ FIELD })
@Retention(RUNTIME)
@Constraint(validatedBy = DoubleMinMaxValidator.class)
@Documented
public @interface DoubleMinMax {
	// 默认错误消息
	String message() default "{doubleMinMax.message}";

	// 分组
	Class<?>[] groups() default {};

	// 负载
	Class<? extends Payload>[] payload() default {};
	
	double min() default Double.MIN_VALUE;
	double max() default Double.MAX_VALUE;

	// 指定多个时使用
	@Target({ FIELD })
	@Retention(RUNTIME)
	@Documented
	@interface List {
		DoubleMinMax[] value();
	}
}
